* GENERAL INFO
	* Project: Red/Blue Workshop and Depolarization
	* ssc install avg_effect 
	* ssc install estout
	* net install dm74.pkg
	* ssc install avg_effect
	* ssc install blindschemes
	* net install dm79.pkg
	
	set scheme plotplainblind
 
* DO FILE INFO
	* Reproduces Figures and Tables appearing in the main text and appendix
	

*********************************************************************************************************************
	
clear
set more off
capture cd "~/Dropbox/Projects/Better Angels RCT/10_Analysis/03_Code/Replication/Final"		


use "Full_BArct_Data_panel.dta"
	
	
** mean values for comparison **
summ therm_diff if wave==1
summ inparty_therm if wave==1
summ outparty_therm if wave==1
summ dinparty if wave==1
		
gen post=0
replace post=1 if wave>1
label define post 0 "Pre-treatment" 1 "Post-treatment"
label values post post

	foreach c in inparty_therm outparty_therm inparty_trust outparty_trust {
	quietly summarize `c' if wave==1
	local m = r(mean)
	local s = r(sd)
	gen `c'_std = (`c' - `m') / `s'
	}
	la var inparty_therm_std "Inparty thermometer (std.)"
	la var outparty_therm_std "Outparty thermometer (std.)"
	la var inparty_trust_std "Inparty trust (std.)"
	la var outparty_trust_std "Outparty trust (std.)"

	

gen canexp_treament=0
	replace canexp_treament=. if wave==1
	replace canexp_treament=1 if canexp_treat_midline==1 & wave==2
	replace canexp_treament=1 if canexp_treat_endline==1 & wave==3
	
	la def canexp_treament 0 "Pro-dem" 1 "Anti-dem"
	*la def canexp_treament 0 "Inparty" 1 "Anti-democratic inparty"
	la val canexp_treament canexp_treament
	

gen prob1_treated = (party3==2 & campus==1)
	replace prob1_treated = 1 if party3==2 & campus==4
	replace prob1_treated = . if party3==.
	la var prob1_treated "Assigned to treatment with prob 1"
	
tab block, gen(block)

*************
* MAIN TEXT *
*************	

* Figure 1 not generated from data
	
* Figure 2: Main effects
	
	eststo affpol_wave: reg affpol_noneg_comf i.treatment##i.wave i.block, cluster(uid)
	eststo iat_wave: reg iat i.treatment##i.wave i.block  , cluster(uid)
	eststo donate_wave: reg donate i.treatment##i.wave i.block  , cluster(uid)
	
	
	
			est restore affpol_wave
			margins, dydx(treatment) at(wave==2)
				matrix ITT_exp_mid = r(table)
					matselrc ITT_exp_mid ITT_exp_mid_coef_CI, r(1, 5, 6) c(2)
			est restore iat_wave
			margins, dydx(treatment) at(wave==2)
				matrix ITT_imp_mid = r(table)
					matselrc ITT_imp_mid ITT_imp_mid_coef_CI, r(1, 5, 6) c(2)
			est restore donate_wave
			margins, dydx(treatment) at(wave==2)
				matrix ITT_beh_mid = r(table)
					matselrc ITT_beh_mid ITT_beh_mid_coef_CI, r(1, 5, 6) c(2)
				
			graph set window fontface "Times"
			coefplot (matrix(ITT_exp_mid_coef_CI[1,]), ci((ITT_exp_mid_coef_CI[2,] ITT_exp_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
				(matrix(ITT_imp_mid_coef_CI[1,]), ci((ITT_imp_mid_coef_CI[2,] ITT_imp_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)) ///
				(matrix(ITT_beh_mid_coef_CI[1,]), ci((ITT_beh_mid_coef_CI[2,] ITT_beh_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(shortdash)) mcolor(black) msymbol(circle)), ///
					name(midline, replace) scheme(plotplain) ///
					xtitle("Treatment effect", margin(medsmall)) xlabel(-1.5(.5).5, nogrid) ///
					ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
					legend(on nostack position(6) cols(3)order(2 "Explicit" 4 "Implicit" 6 "Behavioral")) ///
					xline(0, lcolor(black) lpattern(dash)) ///
					title("Midline")
					
					
			est restore affpol_wave
			margins, dydx(treatment) at(wave==3)
				matrix ITT_exp_end = r(table)
					matselrc ITT_exp_end ITT_exp_end_coef_CI, r(1, 5, 6) c(2)
			est restore iat_wave
			margins, dydx(treatment) at(wave==3)
				matrix ITT_imp_end = r(table)
					matselrc ITT_imp_end ITT_imp_end_coef_CI, r(1, 5, 6) c(2)
			est restore donate_wave
			margins, dydx(treatment) at(wave==3)
				matrix ITT_beh_end = r(table)
					matselrc ITT_beh_end ITT_beh_end_coef_CI, r(1, 5, 6) c(2)
							
			graph set window fontface "Times"
			coefplot (matrix(ITT_exp_end_coef_CI[1,]), ci((ITT_exp_end_coef_CI[2,] ITT_exp_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
				(matrix(ITT_imp_end_coef_CI[1,]), ci((ITT_imp_end_coef_CI[2,] ITT_imp_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)) ///
				(matrix(ITT_beh_end_coef_CI[1,]), ci((ITT_beh_end_coef_CI[2,] ITT_beh_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(shortdash)) mcolor(black) msymbol(circle)), ///
					name(endline, replace) scheme(plotplain) ///
					xtitle("Treatment effect", margin(medsmall)) xlabel(-1.5(.5).5, nogrid) ///
					ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
					legend(on position(6) cols(2) label(1 2 "Explicit" 4 "Implicit" 6 "Behavioral")) ///
					xline(0, lcolor(black) lpattern(dash)) ///
					title("Endline")
					
					
			grc1leg midline endline ,  ycommon scheme(plotplain) col(2)  name(affpol_margins, replace) ///
				title("")
			graph display affpol_margins, xsize(10) ysize(5)	
				graph export "figures/affpol_margins.pdf", as(pdf) replace		

	
* Figure 3: Inparty Outparty
	
	foreach c in inparty_therm outparty_therm inparty_trust outparty_trust {
		eststo `c'_wave: reg `c'_std i.treatment##i.wave i.block  , cluster(uid)	
		eststo `c': reg `c'_std treatment i.wave i.block  if wave~=1 , cluster(uid)
		eststo `c'_wave2: reg `c'_std treatment i.block  if wave==2 , cluster(uid)

		}
	
					
			est restore inparty_therm_wave
			margins, dydx(treatment) at(wave==2)
				matrix ITT_inparty_therm_mid = r(table)
					matselrc ITT_inparty_therm_mid ITT_inparty_therm_mid_coef_CI, r(1, 5, 6) c(2)
			
			est restore outparty_therm_wave
			margins, dydx(treatment) at(wave==2)
				matrix ITT_outparty_therm_mid = r(table)
					matselrc ITT_outparty_therm_mid ITT_outparty_therm_mid_coef_CI, r(1, 5, 6) c(2)
			
			est restore inparty_trust_wave
			margins, dydx(treatment) at(wave==2)
				matrix ITT_inparty_trust_mid = r(table)
					matselrc ITT_inparty_trust_mid ITT_inparty_trust_mid_coef_CI, r(1, 5, 6) c(2)
			
			est restore outparty_trust_wave
			margins, dydx(treatment) at(wave==2)
				matrix ITT_outparty_trust_mid = r(table)
					matselrc ITT_outparty_trust_mid ITT_outparty_trust_mid_coef_CI, r(1, 5, 6) c(2)
			
			graph set window fontface "Times"
			coefplot (matrix(ITT_inparty_therm_mid_coef_CI[1,]), ci((ITT_inparty_therm_mid_coef_CI[2,] ITT_inparty_therm_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
				(matrix(ITT_inparty_trust_mid_coef_CI[1,]), ci((ITT_inparty_trust_mid_coef_CI[2,] ITT_inparty_trust_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(shortdash)) mcolor(black) msymbol(circle)) ///
				(matrix(ITT_outparty_therm_mid_coef_CI[1,]), ci((ITT_outparty_therm_mid_coef_CI[2,] ITT_outparty_therm_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)) ///
				(matrix(ITT_outparty_trust_mid_coef_CI[1,]), ci((ITT_outparty_trust_mid_coef_CI[2,] ITT_outparty_trust_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(dash_dot)) mcolor(black) msymbol(diamond)), ///
					name(midline, replace) scheme(plotplain) ///
					xtitle("Treatment effect", margin(medsmall)) xlabel(-1(.5)1, nogrid) ///
					ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
					legend(on position(6) cols(2) order(2 "In-party thermomenter" 4 "In-party trust" 6 "Out-party thermometer" 8 "Out-party trust")) ///
					xline(0, lcolor(black) lpattern(dash)) ///
					title("Midline")
			
				
			est restore inparty_therm_wave
			margins, dydx(treatment) at(wave==3)
				matrix ITT_inparty_therm_end = r(table)
					matselrc ITT_inparty_therm_end ITT_inparty_therm_end_coef_CI, r(1, 5, 6) c(2)
			
			est restore outparty_therm_wave
			margins, dydx(treatment) at(wave==3)
				matrix ITT_outparty_therm_end = r(table)
					matselrc ITT_outparty_therm_end ITT_outparty_therm_end_coef_CI, r(1, 5, 6) c(2)
			
			est restore inparty_trust_wave
			margins, dydx(treatment) at(wave==3)
				matrix ITT_inparty_trust_end = r(table)
					matselrc ITT_inparty_trust_end ITT_inparty_trust_end_coef_CI, r(1, 5, 6) c(2)
			
			est restore outparty_trust_wave
			margins, dydx(treatment) at(wave==3)
				matrix ITT_outparty_trust_end = r(table)
					matselrc ITT_outparty_trust_end ITT_outparty_trust_end_coef_CI, r(1, 5, 6) c(2)
			
			graph set window fontface "Times"
			coefplot (matrix(ITT_inparty_therm_end_coef_CI[1,]), ci((ITT_inparty_therm_end_coef_CI[2,] ITT_inparty_therm_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
				(matrix(ITT_inparty_trust_end_coef_CI[1,]), ci((ITT_inparty_trust_end_coef_CI[2,] ITT_inparty_trust_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(shortdash)) mcolor(black) msymbol(circle)) ///
				(matrix(ITT_outparty_therm_end_coef_CI[1,]), ci((ITT_outparty_therm_end_coef_CI[2,] ITT_outparty_therm_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)) ///
				(matrix(ITT_outparty_trust_end_coef_CI[1,]), ci((ITT_outparty_trust_end_coef_CI[2,] ITT_outparty_trust_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(dash_dot)) mcolor(black) msymbol(diamond)), ///
					name(endline, replace) scheme(plotplain) ///
					xtitle("Treatment effect", margin(medsmall)) xlabel(-1(.5)1, nogrid) ///
					ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
					legend(on position(6) cols(2) order(2 "In-party thermomenter" 4 "In-party trust" 6 "Out-party thermometer" 8 "Out-party trust")) ///
					xline(0, lcolor(black) lpattern(dash)) ///
					title("Endline")
									
													
			grc1leg midline endline ,  ycommon scheme(plotplain) col(2)  name(inparty_outparty_margins, replace) ///
				title("")
			graph display inparty_outparty_margins, xsize(10) ysize(5)	
				graph export "figures/inparty_outparty_margins.pdf", as(pdf) replace
				
				
* Figure 4: Generated using R: execute Figure4.R
		

* Figure 5: HTE by Party 
		
			
	eststo party1: reg affpol_noneg_comf i.treatment##i.wave##c.party3 i.block  , cluster(uid)
	eststo party2: reg iat i.treatment##i.wave##c.party3 i.block  , cluster(uid)
	eststo party3: reg donate i.treatment##i.wave##c.party3 i.block  , cluster(uid)
						
				 
			foreach n of numlist 1 2 3 {
				 
			est restore party1
			margins, dydx(treatment) at(wave==2 party3==`n')
				matrix ITT_exp_mid = r(table)
					matselrc ITT_exp_mid ITT_exp_mid_coef_CI, r(1, 5, 6) c(2)
			est restore party2
			margins, dydx(treatment) at(wave==2 party3==`n')
				matrix ITT_imp_mid = r(table)
					matselrc ITT_imp_mid ITT_imp_mid_coef_CI, r(1, 5, 6) c(2)
			est restore party3
			margins, dydx(treatment) at(wave==2 party3==`n')
				matrix ITT_beh_mid = r(table)
					matselrc ITT_beh_mid ITT_beh_mid_coef_CI, r(1, 5, 6) c(2)
				
			graph set window fontface "Times"
			coefplot (matrix(ITT_exp_mid_coef_CI[1,]), ci((ITT_exp_mid_coef_CI[2,] ITT_exp_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
				(matrix(ITT_imp_mid_coef_CI[1,]), ci((ITT_imp_mid_coef_CI[2,] ITT_imp_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)) ///
				(matrix(ITT_beh_mid_coef_CI[1,]), ci((ITT_beh_mid_coef_CI[2,] ITT_beh_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(shortdash)) mcolor(black) msymbol(circle)), ///
					name(midline_party`n', replace) scheme(plotplain) ///
					xtitle("Treatment effect", margin(medsmall)) xlabel(-2.5(.5)1, nogrid) ///
					ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
					legend(on nostack position(6) cols(3)order(2 "Explicit" 4 "Implicit" 6 "Behavioral")) ///
					xline(0, lcolor(black) lpattern(dash)) ///
					title("Midline")
					
			}
					
			foreach n of numlist 1 2 3 {
				 
			est restore party1
			margins, dydx(treatment) at(wave==3 party3==`n')
				matrix ITT_exp_mid = r(table)
					matselrc ITT_exp_mid ITT_exp_mid_coef_CI, r(1, 5, 6) c(2)
			est restore party2
			margins, dydx(treatment) at(wave==3 party3==`n')
				matrix ITT_imp_mid = r(table)
					matselrc ITT_imp_mid ITT_imp_mid_coef_CI, r(1, 5, 6) c(2)
			est restore party3
			margins, dydx(treatment) at(wave==3 party3==`n')
				matrix ITT_beh_mid = r(table)
					matselrc ITT_beh_mid ITT_beh_mid_coef_CI, r(1, 5, 6) c(2)
				
			graph set window fontface "Times"
			coefplot (matrix(ITT_exp_mid_coef_CI[1,]), ci((ITT_exp_mid_coef_CI[2,] ITT_exp_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
				(matrix(ITT_imp_mid_coef_CI[1,]), ci((ITT_imp_mid_coef_CI[2,] ITT_imp_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)) ///
				(matrix(ITT_beh_mid_coef_CI[1,]), ci((ITT_beh_mid_coef_CI[2,] ITT_beh_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(shortdash)) mcolor(black) msymbol(circle)), ///
					name(endline_party`n', replace) scheme(plotplain) ///
					xtitle("Treatment effect", margin(medsmall)) xlabel(-2.5(.5)1, nogrid) ///
					ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
					legend(on nostack position(6) cols(3)order(2 "Explicit" 4 "Implicit" 6 "Behavioral")) ///
					xline(0, lcolor(black) lpattern(dash)) ///
					title("Endline")
					
			}
							
					
			grc1leg midline_party1 endline_party1 ,  ycommon scheme(plotplain) col(2)  name(affpol_margins_party1, replace) ///
				title("Democrat")
			
			grc1leg midline_party2 endline_party2 ,  ycommon scheme(plotplain) col(2)  name(affpol_margins_party2, replace) ///
				title("Republican")

			grc1leg midline_party3 endline_party3 ,  ycommon scheme(plotplain) col(2)  name(affpol_margins_party3, replace) ///
				title("Independent")
			
			
			grc1leg affpol_margins_party1 affpol_margins_party2 affpol_margins_party3, xcommon ycommon scheme(plotplain) col(1) pos(6) ///
				name(party_margins, replace) ///
				title("")
			graph display party_margins, xsize(6) ysize(8)
			graph export "figures/hte1_party_margins.pdf", as(pdf) replace	

			
* Figure 6: Generated Using R: execute Figure6.R


************
* APPENDIX *
************	


* Table D.1
summarize affpol_noneg_comf iat donate 

* Table D.2
table gender treatment if wave==2, statistic(frequency) statistic(percent, across(gender))
table white treatment if wave==2, statistic(frequency) statistic(percent, across(white))

* Table D.3 * THIS NEEDS TO BE FIGURED OUT
table gender treatment if wave==2 & part_work==1, statistic(frequency) statistic(percent, across(gender))
table white treatment if wave==2 & part_work==1, statistic(frequency) statistic(percent, across(white))

* Figure F.1: Balance on pretreatment covariates across experimental treatment and control groups

	gl maindv affpol_noneg_comf iat 

	gl mechdv m1a m1b m2a m2b m3 m4 m5 m6 m7
			
	gl cond b_affpol_noneg_comf b_iat b_therm_diff_std b_outparty_against_std b_trust_diff_std b_outparty_friends_std b_outparty_neigh_std b_outparty_marry_std b_outparty_threat_std b_m1a b_m2a b_m2b b_m3 b_m4 b_m5 b_m6 b_m7 b_ideoextreme b_idx_pol_engage b_idx_outparty_contact b_idx_empathy

	gl demo b_woman b_white democrat_lean


* Run regressions and store results with eststo
foreach v in $demo $maindv $cond {
    eststo `v': reg `v' treatment i.block if uidtag==1

}

coefplot $demo $cond, keep(treatment) asequation swapnames ///
		legend(off) xline(0, lcolor(red)) scheme(plotplain) ///
		graphregion(color(white)) legend(off) nooffset ///
		msize(medsmall) ms(O) mc(black) ciopts(lcolor(black)) ///
		xtitle("Marginal Effect of Treatment") ///
		headings(b_woman = "{bf:Demographics}" ///
		b_affpol_noneg_comf = "{bf:Main Outcomes}"                     ///
        b_therm_diff_std = "{bf:Components of Explicit Polarization}"                        ///
        b_m1a = "{bf:Mediators}" ///
		b_ideoextreme = "{bf:Moderators}")

graph export "figures/balance.pdf", as(pdf) replace	

* Figure H.1: Replication data and code for figure omitted to protect respondent confidentiality


* Figure I.1: Treatment effects on initiating cross-partisan conversations


* ITT on cross-partisan conversations
			
			eststo converse_wave: reg outparty_converse i.treatment##i.wave i.block, cluster(uid)
				
	 				 
			est restore converse_wave
			margins, dydx(treatment) at(wave==2)
				matrix ITT_conv_mid = r(table)
					matselrc ITT_conv_mid ITT_conv_mid_coef_CI, r(1, 5, 6) c(2)
				
			graph set window fontface "Times"
			coefplot (matrix(ITT_conv_mid_coef_CI[1,]), ci((ITT_conv_mid_coef_CI[2,] ITT_conv_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)), ///
					name(midline, replace) scheme(plotplain) ///
					xtitle("Treatment effect", margin(medsmall)) xlabel(-1(.5).5, nogrid) ///
					ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
					legend(on nostack position(6) cols(3)order(2 "Cross-partisan conversations")) ///
					xline(0, lcolor(black) lpattern(dash)) ///
					title("Midline")
					
					
			est restore converse_wave
			margins, dydx(treatment) at(wave==3)
				matrix ITT_conv_end = r(table)
					matselrc ITT_conv_end ITT_conv_end_coef_CI, r(1, 5, 6) c(2)
							
			graph set window fontface "Times"
			coefplot (matrix(ITT_conv_end_coef_CI[1,]), ci((ITT_conv_end_coef_CI[2,] ITT_conv_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)), ///
					name(endline, replace) scheme(plotplain) ///
					xtitle("Treatment effect", margin(medsmall)) xlabel(-1(.5).5, nogrid) ///
					ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
					legend(on position(6) cols(2) label(2 "Cross-partisan conversations")) ///
					xline(0, lcolor(black) lpattern(dash)) ///
					title("Endline")
					
					
			grc1leg midline endline ,  ycommon scheme(plotplain) col(2)  name(converse_margins, replace) ///
				title("")
			graph display converse_margins, xsize(10) ysize(5)	
			graph export "figures/converse_margins.pdf", as(pdf) replace		

			
* Figure J.1: Treatment effects on pre-specified mechanisms

	eststo m1a_wave: reg m1a i.treatment##i.wave i.block, cluster(uid)				
	eststo m2b_wave: reg m2b i.treatment##i.wave i.block, cluster(uid)				
	eststo m3_wave: reg m3 i.treatment##i.wave i.block, cluster(uid)				
	eststo m4_wave: reg m4 i.treatment##i.wave i.block, cluster(uid)				
	eststo m5_wave: reg m5 i.treatment##i.wave i.block, cluster(uid)				
	eststo m6_wave: reg m6 i.treatment##i.wave i.block, cluster(uid)				
	eststo m7_wave: reg m7 i.treatment##i.wave i.block, cluster(uid)
	
* ITT on predicted mechanisms


			foreach m in m1a m2b m3 m4 m5 m6 m7 {
				est restore `m'_wave
					margins, dydx(treatment) at(wave==2)
						matrix ITT_`m'_mid = r(table)
							matselrc ITT_`m'_mid ITT_`m'_mid_coef_CI, r(1, 5, 6) c(2)

				}
	
			graph set window fontface "Times"
			coefplot (matrix(ITT_m1a_mid_coef_CI[1,]), ci((ITT_m1a_mid_coef_CI[2,] ITT_m1a_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
				(matrix(ITT_m2b_mid_coef_CI[1,]), ci((ITT_m2b_mid_coef_CI[2,] ITT_m2b_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(triangle)) ///
				(matrix(ITT_m3_mid_coef_CI[1,]), ci((ITT_m3_mid_coef_CI[2,] ITT_m3_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(circle)) ///
				(matrix(ITT_m4_mid_coef_CI[1,]), ci((ITT_m4_mid_coef_CI[2,] ITT_m4_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(diamond)) ///
				(matrix(ITT_m5_mid_coef_CI[1,]), ci((ITT_m5_mid_coef_CI[2,] ITT_m5_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(plus)) ///
				(matrix(ITT_m6_mid_coef_CI[1,]), ci((ITT_m6_mid_coef_CI[2,] ITT_m6_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(X)) ///
				(matrix(ITT_m7_mid_coef_CI[1,]), ci((ITT_m7_mid_coef_CI[2,] ITT_m7_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(circle_hollow)), ///						
				name(midline_mech, replace) scheme(plotplain) ///
					xtitle("Treatment effect", margin(medsmall)) xlabel(-1(.5)1, nogrid) ///
					ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
					legend(on position(6) cols(2) order(2 "Out-group stereotyping" 4 "Ideological polarization" 6 "Perceived mass ideological polarization" 8 "Out-group empathy" 10 "Out-group humanization" 12 "Moralization of politics" 14 "In-group identity salience")) ///
					xline(0, lcolor(black) lpattern(dash)) ///
					title("Midline")
				
				
			foreach m in m1a m2b m3 m4 m5 m6 m7 {
				est restore `m'_wave
					margins, dydx(treatment) at(wave==3)
						matrix ITT_`m'_end = r(table)
							matselrc ITT_`m'_end ITT_`m'_end_coef_CI, r(1, 5, 6) c(2)

				}		
					
	
	
			graph set window fontface "Times"
			coefplot (matrix(ITT_m1a_end_coef_CI[1,]), ci((ITT_m1a_end_coef_CI[2,] ITT_m1a_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
				(matrix(ITT_m2b_end_coef_CI[1,]), ci((ITT_m2b_end_coef_CI[2,] ITT_m2b_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(triangle)) ///
				(matrix(ITT_m3_end_coef_CI[1,]), ci((ITT_m3_end_coef_CI[2,] ITT_m3_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(circle)) ///
				(matrix(ITT_m4_end_coef_CI[1,]), ci((ITT_m4_end_coef_CI[2,] ITT_m4_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(diamond)) ///
				(matrix(ITT_m5_end_coef_CI[1,]), ci((ITT_m5_end_coef_CI[2,] ITT_m5_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(plus)) ///
				(matrix(ITT_m6_end_coef_CI[1,]), ci((ITT_m6_end_coef_CI[2,] ITT_m6_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(X)) ///
				(matrix(ITT_m7_end_coef_CI[1,]), ci((ITT_m7_end_coef_CI[2,] ITT_m7_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(circle_hollow)), ///						
				name(endline_mech, replace) scheme(plotplain) ///
					xtitle("Treatment effect", margin(medsmall)) xlabel(-1(.5)1, nogrid) ///
					ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
					legend(on position(6) cols(2) order(2 "Out-group stereotyping" 4 "Ideological polarization" 6 "Perceived mass ideological polarization" 8 "Out-group empathy" 10 "Out-group humanization" 12 "Moralization of politics" 14 "In-group identity salience")) ///
					xline(0, lcolor(black) lpattern(dash)) ///
					title("Endline")
		
			grc1leg midline_mech endline_mech ,  ycommon scheme(plotplain) col(1)  name(mech, replace) ///
				title("")
			graph display mech, xsize(8) ysize(10)	
			graph export "figures/mech_margins.pdf", as(pdf) replace	

			
* Figure K.1: Treatment effects on affective polarization and support for depolarization by baseline ideological polarization

	eststo ideo1: reg affpol_noneg_comf i.treatment##i.b_ideoextreme##i.wave i.block  , cluster(uid)
	eststo ideo2: reg iat i.treatment##i.b_ideoextreme##i.wave i.block  , cluster(uid)
	eststo ideo3: reg donate i.treatment##i.b_ideoextreme##i.wave i.block  , cluster(uid)


				foreach n of numlist 0 1 2 3 {
			
				est restore ideo1 
					margins, dydx(treatment) at(wave==2 b_ideoextreme==`n')
						matrix ITT_exp_mid = r(table)
							matselrc ITT_exp_mid ITT_exp_mid_coef_CI, r(1, 5, 6) c(2)
				est restore ideo2
					margins, dydx(treatment) at(wave==2 b_ideoextreme==`n')
						matrix ITT_imp_mid = r(table)
							matselrc ITT_imp_mid ITT_imp_mid_coef_CI, r(1, 5, 6) c(2)
				est restore ideo3
					margins, dydx(treatment) at(wave==2 b_ideoextreme==`n')
						matrix ITT_beh_mid = r(table)
							matselrc ITT_beh_mid ITT_beh_coef_CI, r(1, 5, 6) c(2)

				graph set window fontface "Times"
				coefplot (matrix(ITT_exp_mid_coef_CI[1,]), ci((ITT_exp_mid_coef_CI[2,] ITT_exp_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
					(matrix(ITT_imp_mid_coef_CI[1,]), ci((ITT_imp_mid_coef_CI[2,] ITT_imp_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)) ///
					(matrix(ITT_beh_coef_CI[1,]), ci((ITT_beh_coef_CI[2,] ITT_beh_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(shortdash)) mcolor(black) msymbol(circle)), ///
						name(midline_ideo`n', replace) scheme(plotplain) ///
						xtitle("Treatment effect", margin(medsmall)) xlabel(-5(1)3, nogrid) ///
						ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
						legend(on nostack position(6) cols(3)order(2 "Explicit" 4 "Implicit" 6 "Behavioral")) ///
						xline(0, lcolor(black) lpattern(dash)) ///
						title("Midline")
					
					}
				

				foreach n of numlist 0 1 2 3 {
			
				est restore ideo1 
					margins, dydx(treatment) at(wave==3 b_ideoextreme==`n')
						matrix ITT_exp_end = r(table)
							matselrc ITT_exp_end ITT_exp_end_coef_CI, r(1, 5, 6) c(2)
				est restore ideo2
					margins, dydx(treatment) at(wave==3 b_ideoextreme==`n')
						matrix ITT_imp_end = r(table)
							matselrc ITT_imp_end ITT_imp_end_coef_CI, r(1, 5, 6) c(2)
				est restore ideo3
					margins, dydx(treatment) at(wave==3 b_ideoextreme==`n')
						matrix ITT_beh_end = r(table)
							matselrc ITT_beh_end ITT_beh_coef_CI, r(1, 5, 6) c(2)

				graph set window fontface "Times"
				coefplot (matrix(ITT_exp_end_coef_CI[1,]), ci((ITT_exp_end_coef_CI[2,] ITT_exp_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
					(matrix(ITT_imp_end_coef_CI[1,]), ci((ITT_imp_end_coef_CI[2,] ITT_imp_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)) ///
					(matrix(ITT_beh_coef_CI[1,]), ci((ITT_beh_coef_CI[2,] ITT_beh_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(shortdash)) mcolor(black) msymbol(circle)), ///
						name(endline_ideo`n', replace) scheme(plotplain) ///
						xtitle("Treatment effect", margin(medsmall)) xlabel(-5(1)3, nogrid) ///
						ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
						legend(on nostack position(6) cols(3)order(2 "Explicit" 4 "Implicit" 6 "Behavioral")) ///
						xline(0, lcolor(black) lpattern(dash)) ///
						title("Endline")
					
					}
				
			grc1leg midline_ideo0 endline_ideo0 ,  ycommon scheme(plotplain) col(2)  name(affpol_margins_ideo0, replace) ///
				title("Quartile 1")

			grc1leg midline_ideo1 endline_ideo1 ,  ycommon scheme(plotplain) col(2)  name(affpol_margins_ideo1, replace) ///
				title("Quartile 2")
			
			grc1leg midline_ideo2 endline_ideo2 ,  ycommon scheme(plotplain) col(2)  name(affpol_margins_ideo2, replace) ///
				title("Quartile 3")

			grc1leg midline_ideo3 endline_ideo3 ,  ycommon scheme(plotplain) col(2)  name(affpol_margins_ideo3, replace) ///
				title("Quartile 4")
								
			grc1leg affpol_margins_ideo0 affpol_margins_ideo1 affpol_margins_ideo2 affpol_margins_ideo3, xcommon ycommon scheme(plotplain) col(1) pos(6) ///
				name(ideo_margins, replace) ///
				title("")
			graph display ideo_margins, xsize(6) ysize(8)
			graph export "figures/hte1_ideo_margins.pdf", as(pdf) replace	

			
* Figure K.2: Treatment effects on affective polarization and support for depolarization by baseline ideological polarization

	eststo poleng1: reg affpol_noneg_comf i.treatment##i.b_idx_pol_engage_c##i.wave i.block  , cluster(uid)
	eststo poleng2: reg iat i.treatment##i.b_idx_pol_engage_c##i.wave i.block  , cluster(uid)
	eststo poleng3: reg donate i.treatment##i.b_idx_pol_engage_c##i.wave i.block , cluster(uid)		
	

				foreach n of numlist 1 2 3 4 {
			
				est restore poleng1 
					margins, dydx(treatment) at(wave==2 b_idx_pol_engage_c==`n')
						matrix ITT_exp_mid = r(table)
							matselrc ITT_exp_mid ITT_exp_mid_coef_CI, r(1, 5, 6) c(2)
				est restore poleng2
					margins, dydx(treatment) at(wave==2 b_idx_pol_engage_c==`n')
						matrix ITT_imp_mid = r(table)
							matselrc ITT_imp_mid ITT_imp_mid_coef_CI, r(1, 5, 6) c(2)
				est restore poleng3
					margins, dydx(treatment) at(wave==2 b_idx_pol_engage_c==`n')
						matrix ITT_beh_mid = r(table)
							matselrc ITT_beh_mid ITT_beh_coef_CI, r(1, 5, 6) c(2)

				graph set window fontface "Times"
				coefplot (matrix(ITT_exp_mid_coef_CI[1,]), ci((ITT_exp_mid_coef_CI[2,] ITT_exp_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
					(matrix(ITT_imp_mid_coef_CI[1,]), ci((ITT_imp_mid_coef_CI[2,] ITT_imp_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)) ///
					(matrix(ITT_beh_coef_CI[1,]), ci((ITT_beh_coef_CI[2,] ITT_beh_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(shortdash)) mcolor(black) msymbol(circle)), ///
						name(midline_poleng`n', replace) scheme(plotplain) ///
						xtitle("Treatment effect", margin(medsmall)) xlabel(-5(1)3, nogrid) ///
						ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
						legend(on nostack position(6) cols(3)order(2 "Explicit" 4 "Implicit" 6 "Behavioral")) ///
						xline(0, lcolor(black) lpattern(dash)) ///
						title("Midline")
					
					}
				

				foreach n of numlist 1 2 3 4 {
			
				est restore poleng1 
					margins, dydx(treatment) at(wave==3 b_idx_pol_engage_c==`n')
						matrix ITT_exp_end = r(table)
							matselrc ITT_exp_end ITT_exp_end_coef_CI, r(1, 5, 6) c(2)
				est restore poleng2
					margins, dydx(treatment) at(wave==3 b_idx_pol_engage_c==`n')
						matrix ITT_imp_end = r(table)
							matselrc ITT_imp_end ITT_imp_end_coef_CI, r(1, 5, 6) c(2)
				est restore poleng3
					margins, dydx(treatment) at(wave==3 b_idx_pol_engage_c==`n')
						matrix ITT_beh_end = r(table)
							matselrc ITT_beh_end ITT_beh_coef_CI, r(1, 5, 6) c(2)

				graph set window fontface "Times"
				coefplot (matrix(ITT_exp_end_coef_CI[1,]), ci((ITT_exp_end_coef_CI[2,] ITT_exp_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
					(matrix(ITT_imp_end_coef_CI[1,]), ci((ITT_imp_end_coef_CI[2,] ITT_imp_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)) ///
					(matrix(ITT_beh_coef_CI[1,]), ci((ITT_beh_coef_CI[2,] ITT_beh_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(shortdash)) mcolor(black) msymbol(circle)), ///
						name(endline_poleng`n', replace) scheme(plotplain) ///
						xtitle("Treatment effect", margin(medsmall)) xlabel(-5(1)3, nogrid) ///
						ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
						legend(on nostack position(6) cols(3)order(2 "Explicit" 4 "Implicit" 6 "Behavioral")) ///
						xline(0, lcolor(black) lpattern(dash)) ///
						title("Endline")
					
					}
				
			grc1leg midline_poleng1 endline_poleng1 ,  ycommon scheme(plotplain) col(2)  name(affpol_margins_poleng1, replace) ///
				title("Quartile 1")

			grc1leg midline_poleng2 endline_poleng2 ,  ycommon scheme(plotplain) col(2)  name(affpol_margins_poleng2, replace) ///
				title("Quartile 2")

			grc1leg midline_poleng3 endline_poleng3 ,  ycommon scheme(plotplain) col(2)  name(affpol_margins_poleng3, replace) ///
				title("Quartile 3")

			grc1leg midline_poleng4 endline_poleng4 ,  ycommon scheme(plotplain) col(2)  name(affpol_margins_poleng4, replace) ///
				title("Quartile 4")

			grc1leg affpol_margins_poleng1  affpol_margins_poleng2 affpol_margins_poleng3 affpol_margins_poleng4, xcommon ycommon scheme(plotplain) col(1) pos(6) ///
				name(poleng_margins, replace) ///
				title("")
			graph display poleng_margins, xsize(6) ysize(8)
			graph export "figures/hte1_poleng_margins.pdf", as(pdf) replace	
				

* Figure K.3: reatment effects on affective polarization and support for depolarization by baseline rate of out-party contact

	eststo contact1: reg affpol_noneg_comf i.treatment##c.b_idx_outparty_contact_c##i.wave i.block  , cluster(uid)		
	eststo contact2: reg iat i.treatment##c.b_idx_outparty_contact_c##i.wave i.block , cluster(uid)			
	eststo contact3: reg donate i.treatment##c.b_idx_outparty_contact_c##i.wave i.block , cluster(uid)


			foreach n of numlist 1 2 3 4 {
			
				est restore contact1 
					margins, dydx(treatment) at(wave==2 b_idx_outparty_contact_c==`n')
						matrix ITT_exp_mid = r(table)
							matselrc ITT_exp_mid ITT_exp_mid_coef_CI, r(1, 5, 6) c(2)
				est restore contact2
					margins, dydx(treatment) at(wave==2 b_idx_outparty_contact_c==`n')
						matrix ITT_imp_mid = r(table)
							matselrc ITT_imp_mid ITT_imp_mid_coef_CI, r(1, 5, 6) c(2)
				est restore contact3
					margins, dydx(treatment) at(wave==2 b_idx_outparty_contact_c==`n')
						matrix ITT_beh_mid = r(table)
							matselrc ITT_beh_mid ITT_beh_coef_CI, r(1, 5, 6) c(2)

				graph set window fontface "Times"
				coefplot (matrix(ITT_exp_mid_coef_CI[1,]), ci((ITT_exp_mid_coef_CI[2,] ITT_exp_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
					(matrix(ITT_imp_mid_coef_CI[1,]), ci((ITT_imp_mid_coef_CI[2,] ITT_imp_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)) ///
					(matrix(ITT_beh_coef_CI[1,]), ci((ITT_beh_coef_CI[2,] ITT_beh_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(shortdash)) mcolor(black) msymbol(circle)), ///
						name(midline_contact`n', replace) scheme(plotplain) ///
						xtitle("Treatment effect", margin(medsmall)) xlabel(-5(1)3, nogrid) ///
						ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
						legend(on nostack position(6) cols(3)order(2 "Explicit" 4 "Implicit" 6 "Behavioral")) ///
						xline(0, lcolor(black) lpattern(dash)) ///
						title("Midline")
					
					}
				

			foreach n of numlist 1 2 3 4 {
			
				est restore contact1 
					margins, dydx(treatment) at(wave==3 b_idx_outparty_contact_c==`n')
						matrix ITT_exp_end = r(table)
							matselrc ITT_exp_end ITT_exp_end_coef_CI, r(1, 5, 6) c(2)
				est restore contact2
					margins, dydx(treatment) at(wave==3 b_idx_outparty_contact_c==`n')
						matrix ITT_imp_end = r(table)
							matselrc ITT_imp_end ITT_imp_end_coef_CI, r(1, 5, 6) c(2)
				est restore contact3
					margins, dydx(treatment) at(wave==3 b_idx_outparty_contact_c==`n')
						matrix ITT_beh_end = r(table)
							matselrc ITT_beh_end ITT_beh_coef_CI, r(1, 5, 6) c(2)

				graph set window fontface "Times"
				coefplot (matrix(ITT_exp_end_coef_CI[1,]), ci((ITT_exp_end_coef_CI[2,] ITT_exp_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
					(matrix(ITT_imp_end_coef_CI[1,]), ci((ITT_imp_end_coef_CI[2,] ITT_imp_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)) ///
					(matrix(ITT_beh_coef_CI[1,]), ci((ITT_beh_coef_CI[2,] ITT_beh_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(shortdash)) mcolor(black) msymbol(circle)), ///
						name(endline_contact`n', replace) scheme(plotplain) ///
						xtitle("Treatment effect", margin(medsmall)) xlabel(-5(1)3, nogrid) ///
						ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
						legend(on nostack position(6) cols(3)order(2 "Explicit" 4 "Implicit" 6 "Behavioral")) ///
						xline(0, lcolor(black) lpattern(dash)) ///
						title("Endline")
					
					}
				
			grc1leg midline_contact1 endline_contact1 ,  ycommon scheme(plotplain) col(2)  name(affpol_margins_contact1, replace) ///
				title("Quartile 1")

			grc1leg midline_contact2 endline_contact2 ,  ycommon scheme(plotplain) col(2)  name(affpol_margins_contact2, replace) ///
				title("Quartile 2")

			grc1leg midline_contact3 endline_contact3 ,  ycommon scheme(plotplain) col(2)  name(affpol_margins_contact3, replace) ///
				title("Quartile 3")

			grc1leg midline_contact4 endline_contact4 ,  ycommon scheme(plotplain) col(2)  name(affpol_margins_contact4, replace) ///
				title("Quartile 4")

			grc1leg affpol_margins_contact1  affpol_margins_contact2 affpol_margins_contact3 affpol_margins_contact4, xcommon ycommon scheme(plotplain) col(1) pos(6) ///
				name(contact_margins, replace) ///
				title("")
			graph display contact_margins, xsize(6) ysize(8)
			graph export "figures/hte1_contact_margins.pdf", as(pdf) replace	
			
			
* Figure K.4: Treatment effects on affective polarization and support for depolarization by baseline dispositional empathy

	eststo empathy1: reg affpol_noneg_comf i.treatment##c.b_idx_empathy_c##i.wave i.block  , cluster(uid)
	eststo empathy2: reg iat i.treatment##c.b_idx_empathy_c##i.wave i.block   , cluster(uid)		
	eststo empathy3: reg donate i.treatment##c.b_idx_empathy_c##i.wave i.block  , cluster(uid)



			foreach n of numlist 1 2 3 4 {
			
				est restore empathy1 
					margins, dydx(treatment) at(wave==2 b_idx_empathy_c==`n')
						matrix ITT_exp_mid = r(table)
							matselrc ITT_exp_mid ITT_exp_mid_coef_CI, r(1, 5, 6) c(2)
				est restore empathy2
					margins, dydx(treatment) at(wave==2 b_idx_empathy_c==`n')
						matrix ITT_imp_mid = r(table)
							matselrc ITT_imp_mid ITT_imp_mid_coef_CI, r(1, 5, 6) c(2)
				est restore empathy3
					margins, dydx(treatment) at(wave==2 b_idx_empathy_c==`n')
						matrix ITT_beh_mid = r(table)
							matselrc ITT_beh_mid ITT_beh_coef_CI, r(1, 5, 6) c(2)

				graph set window fontface "Times"
				coefplot (matrix(ITT_exp_mid_coef_CI[1,]), ci((ITT_exp_mid_coef_CI[2,] ITT_exp_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
					(matrix(ITT_imp_mid_coef_CI[1,]), ci((ITT_imp_mid_coef_CI[2,] ITT_imp_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)) ///
					(matrix(ITT_beh_coef_CI[1,]), ci((ITT_beh_coef_CI[2,] ITT_beh_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(shortdash)) mcolor(black) msymbol(circle)), ///
						name(midline_empathy`n', replace) scheme(plotplain) ///
						xtitle("Treatment effect", margin(medsmall)) xlabel(-5(1)3, nogrid) ///
						ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
						legend(on nostack position(6) cols(3)order(2 "Explicit" 4 "Implicit" 6 "Behavioral")) ///
						xline(0, lcolor(black) lpattern(dash)) ///
						title("Midline")
					
					}
				

			foreach n of numlist 1 2 3 4 {
			
				est restore empathy1 
					margins, dydx(treatment) at(wave==3 b_idx_empathy_c==`n')
						matrix ITT_exp_end = r(table)
							matselrc ITT_exp_end ITT_exp_end_coef_CI, r(1, 5, 6) c(2)
				est restore empathy2
					margins, dydx(treatment) at(wave==3 b_idx_empathy_c==`n')
						matrix ITT_imp_end = r(table)
							matselrc ITT_imp_end ITT_imp_end_coef_CI, r(1, 5, 6) c(2)
				est restore empathy3
					margins, dydx(treatment) at(wave==3 b_idx_empathy_c==`n')
						matrix ITT_beh_end = r(table)
							matselrc ITT_beh_end ITT_beh_coef_CI, r(1, 5, 6) c(2)

				graph set window fontface "Times"
				coefplot (matrix(ITT_exp_end_coef_CI[1,]), ci((ITT_exp_end_coef_CI[2,] ITT_exp_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
					(matrix(ITT_imp_end_coef_CI[1,]), ci((ITT_imp_end_coef_CI[2,] ITT_imp_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)) ///
					(matrix(ITT_beh_coef_CI[1,]), ci((ITT_beh_coef_CI[2,] ITT_beh_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(shortdash)) mcolor(black) msymbol(circle)), ///
						name(endline_empathy`n', replace) scheme(plotplain) ///
						xtitle("Treatment effect", margin(medsmall)) xlabel(-5(1)3, nogrid) ///
						ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
						legend(on nostack position(6) cols(3)order(2 "Explicit" 4 "Implicit" 6 "Behavioral")) ///
						xline(0, lcolor(black) lpattern(dash)) ///
						title("Endline")
					
					}
				
			grc1leg midline_empathy1 endline_empathy1 ,  ycommon scheme(plotplain) col(2)  name(affpol_margins_empathy1, replace) ///
				title("Quartile 1")

			grc1leg midline_empathy2 endline_empathy2 ,  ycommon scheme(plotplain) col(2)  name(affpol_margins_empathy2, replace) ///
				title("Quartile 2")

			grc1leg midline_empathy3 endline_empathy3 ,  ycommon scheme(plotplain) col(2)  name(affpol_margins_empathy3, replace) ///
				title("Quartile 3")

			grc1leg midline_empathy4 endline_empathy4 ,  ycommon scheme(plotplain) col(2)  name(affpol_margins_empathy4, replace) ///
				title("Quartile 4")

			grc1leg affpol_margins_empathy1  affpol_margins_empathy2 affpol_margins_empathy3 affpol_margins_empathy4, xcommon ycommon scheme(plotplain) col(1) pos(6) ///
				name(empathy_margins, replace) ///
				title("")
			graph display empathy_margins, xsize(6) ysize(8)
			graph export "figures/hte1_empathy_margins.pdf", as(pdf) replace	
				

* Figure L.1: Treatment effects on affective polarization and support for depolarization, pooling across rounds

	eststo affpol_pooled: reg affpol_noneg_comf treatment i.wave i.block if wave!=1 , cluster(uid) 
	eststo iat_pooled: reg iat treatment i.wave i.block if wave!=1 , cluster(uid)
	eststo donate_pooled: reg donate treatment i.wave i.block if wave!=1 , cluster(uid)	

				graph set window fontface "Times"

				coefplot (affpol_pooled, recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
				 (iat_pooled, recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)) ///
				 (donate_pooled, recast(scatter) ciopts(lcolor(black) lpattern(shortdash)) mcolor(black) msymbol(circle)), ///
									keep(treatment) ///
									name(midline, replace) scheme(plotplain) ///
									xtitle("Treatment effect", margin(medsmall)) xlabel(-1.5(.5).5, nogrid) ///
									ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
									legend(on nostack position(6) cols(3)order(2 "Explicit" 4 "Implicit" 6 "Behavioral")) ///
									xline(0, lcolor(black) lpattern(dash)) ///
									title("Pooled")
		
				graph export "figures/affpol_pooled_waveblockFE.pdf", as(pdf) replace


* Figure L.2: Treatment effects on affective polarization and support for depolarization, pooling across rounds
	
	eststo affpol_mid: reg affpol_noneg_comf treatment i.block if wave==2
	eststo affpol_end: reg affpol_noneg_comf treatment i.block if wave==3
	eststo iat_mid: reg iat treatment i.block if wave==2 
	eststo iat_end: reg iat treatment i.block if wave==3 
	eststo donate_mid: reg donate treatment i.block if wave==2	
	eststo donate_end: reg donate treatment i.block if wave==3

				* Midline
				graph set window fontface "Times"
				coefplot (affpol_mid, recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
				 (iat_mid, recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)) ///
				 (donate_mid, recast(scatter) ciopts(lcolor(black) lpattern(shortdash)) mcolor(black) msymbol(circle)), ///
									keep(treatment) ///
									name(midline, replace) scheme(plotplain) ///
									xtitle("Treatment effect", margin(medsmall)) xlabel(-1.5(.5).5, nogrid) ///
									ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
									legend(on nostack position(6) cols(3)order(2 "Explicit" 4 "Implicit" 6 "Behavioral")) ///
									xline(0, lcolor(black) lpattern(dash)) ///
									title("By survey-round analysis: Midline")		
									

									
				* Endline
				graph set window fontface "Times"
				coefplot (affpol_end, recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
				 (iat_end, recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)) ///
				 (donate_end, recast(scatter) ciopts(lcolor(black) lpattern(shortdash)) mcolor(black) msymbol(circle)), ///
									keep(treatment) ///
									name(endline, replace) scheme(plotplain) ///
									xtitle("Treatment effect", margin(medsmall)) xlabel(-1.5(.5).5, nogrid) ///
									ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
									legend(on nostack position(6) cols(3)order(2 "Explicit" 4 "Implicit" 6 "Behavioral")) ///
									xline(0, lcolor(black) lpattern(dash)) ///
									title("By survey-round analysis: Endline")	
									
	
	
				grc1leg midline endline,  ycommon scheme(plotplain) col(2)  name(affpol_bywave, replace) ///
				title("")
				graph display affpol_bywave, xsize(10) ysize(5)
				graph export "figures/affpol_bywave.pdf", as(pdf) replace		

 
 
* Figure M.1: Average Effect Size aggregating across measures of affective polarization and support for depolarization

		* generate

		avg_effect idx_affect_pol_noneg_comf dinparty idx_donate_depol if wave==2, effectvar(treatment) controltest(treatment==0) x(treatment block1-block16)
		eststo aes_mid
			
		avg_effect idx_affect_pol_noneg_comf dinparty idx_donate_depol if wave==3, effectvar(treatment) controltest(treatment==0) x(treatment block1-block16)
		eststo aes_end
						
		avg_effect idx_affect_pol_noneg_comf dinparty idx_donate_depol outparty_no_converse if wave==2, effectvar(treatment) controltest(treatment==0) x(treatment block1-block16)
		eststo aes_mid_conv
			
		avg_effect idx_affect_pol_noneg_comf dinparty idx_donate_depol outparty_no_converse if wave==3, effectvar(treatment) controltest(treatment==0) x(treatment block1-block16)
		eststo aes_end_conv

 			
			est restore aes_mid
				ereturn list
				matrix aes_mid_coef = e(b)
				matrix V = e(V)
					matrix aes_se = sqrt(V[1,1])				
					matrix aes_CI_lower = aes_mid_coef - 1.96 * aes_se
					matrix aes_CI_upper = aes_mid_coef + 1.96 * aes_se
					matrix aes_mid_coef_CI = aes_mid_coef \ aes_CI_lower \ aes_CI_upper
			
			est restore aes_mid_conv
				ereturn list
				matrix aes_mid_conv_coef = e(b)
				matrix V = e(V)
					matrix aes_se = sqrt(V[1,1])				
					matrix aes_CI_lower = aes_mid_conv_coef - 1.96 * aes_se
					matrix aes_CI_upper = aes_mid_conv_coef + 1.96 * aes_se
					matrix aes_mid_conv_coef_CI = aes_mid_conv_coef \ aes_CI_lower \ aes_CI_upper

			graph set window fontface "Times"
			coefplot (matrix(aes_mid_coef_CI[1,]), ci((aes_mid_coef_CI[2,] aes_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
				(matrix(aes_mid_conv_coef_CI[1,]), ci((aes_mid_conv_coef_CI[2,] aes_mid_conv_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)), ///
					name(midline, replace) scheme(plotplain) ///
					xtitle("Treatment effect", margin(medsmall)) xlabel(-1.5(.5).5, nogrid) ///
					ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
					legend(on nostack position(6) cols(2)order(2 "AES" 4 "AES w/ cross-partisan conversations" )) ///
					xline(0, lcolor(black) lpattern(dash)) ///
					title("Midline")
			
			est restore aes_end
				ereturn list
				matrix aes_end_coef = e(b)
				matrix V = e(V)
					matrix aes_se = sqrt(V[1,1])				
					matrix aes_CI_lower = aes_end_coef - 1.96 * aes_se
					matrix aes_CI_upper = aes_end_coef + 1.96 * aes_se
					matrix aes_end_coef_CI = aes_end_coef \ aes_CI_lower \ aes_CI_upper
			
			est restore aes_end_conv
				ereturn list
				matrix aes_end_conv_coef = e(b)
				matrix V = e(V)
					matrix aes_se = sqrt(V[1,1])				
					matrix aes_CI_lower = aes_end_conv_coef - 1.96 * aes_se
					matrix aes_CI_upper = aes_end_conv_coef + 1.96 * aes_se
					matrix aes_end_conv_coef_CI = aes_end_conv_coef \ aes_CI_lower \ aes_CI_upper

			graph set window fontface "Times"
			coefplot (matrix(aes_end_coef_CI[1,]), ci((aes_end_coef_CI[2,] aes_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
				(matrix(aes_end_conv_coef_CI[1,]), ci((aes_end_conv_coef_CI[2,] aes_end_conv_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)), ///
					name(endline, replace) scheme(plotplain) ///
					xtitle("Treatment effect", margin(medsmall)) xlabel(-1.5(.5).5, nogrid) ///
					ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
					legend(on nostack position(6) cols(2)order(2 "AES" 4 "AES w/ cross-partisan conversations")) ///
					xline(0, lcolor(black) lpattern(dash)) ///
					title("Endline")
										
		grc1leg midline endline ,  ycommon scheme(plotplain) col(2)  name(aes_margins, replace) ///
				title("")
		graph display aes_margins, xsize(10) ysize(5)	
		graph export "figures/aes_margins.pdf", as(pdf) replace	
		
		
		
* Figure N.1: Treatment effects on affective polarization and support for depolarization, adjusting for baseline covariates
		
	eststo affpol_covars_wave: reg affpol_noneg_comf i.treatment##i.wave i.block m_senior b_woman b_white democrat_lean, cluster(uid)
	eststo iat_covars_wave: reg iat i.treatment##i.wave i.block m_senior b_woman b_white democrat_lean , cluster(uid)
	eststo donate_covars_wave: reg donate i.treatment##i.wave i.block m_senior b_woman b_white democrat_lean , cluster(uid)
		

			est restore affpol_covars_wave
			margins, dydx(treatment) at(wave==2)
				matrix ITT_exp_mid = r(table)
					matselrc ITT_exp_mid ITT_exp_mid_coef_CI, r(1, 5, 6) c(2)
			est restore iat_covars_wave
			margins, dydx(treatment) at(wave==2)
				matrix ITT_imp_mid = r(table)
					matselrc ITT_imp_mid ITT_imp_mid_coef_CI, r(1, 5, 6) c(2)
			est restore donate_covars_wave
			margins, dydx(treatment) at(wave==2)
				matrix ITT_beh_mid = r(table)
					matselrc ITT_beh_mid ITT_beh_mid_coef_CI, r(1, 5, 6) c(2)
				
			graph set window fontface "Times"
			coefplot (matrix(ITT_exp_mid_coef_CI[1,]), ci((ITT_exp_mid_coef_CI[2,] ITT_exp_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
				(matrix(ITT_imp_mid_coef_CI[1,]), ci((ITT_imp_mid_coef_CI[2,] ITT_imp_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)) ///
				(matrix(ITT_beh_mid_coef_CI[1,]), ci((ITT_beh_mid_coef_CI[2,] ITT_beh_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(shortdash)) mcolor(black) msymbol(circle)), ///
					name(midline, replace) scheme(plotplain) ///
					xtitle("Covariate-adjusted treatment effect", margin(medsmall)) xlabel(-2(.5).5, nogrid) ///
					ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
					legend(on nostack position(6) cols(3)order(2 "Explicit" 4 "Implicit" 6 "Behavioral")) ///
					xline(0, lcolor(black) lpattern(dash)) ///
					title("Midline")
					
					
			est restore affpol_covars_wave
			margins, dydx(treatment) at(wave==3)
				matrix ITT_exp_end = r(table)
					matselrc ITT_exp_end ITT_exp_end_coef_CI, r(1, 5, 6) c(2)
			est restore iat_covars_wave
			margins, dydx(treatment) at(wave==3)
				matrix ITT_imp_end = r(table)
					matselrc ITT_imp_end ITT_imp_end_coef_CI, r(1, 5, 6) c(2)
			est restore donate_covars_wave
			margins, dydx(treatment) at(wave==3)
				matrix ITT_beh_end = r(table)
					matselrc ITT_beh_end ITT_beh_end_coef_CI, r(1, 5, 6) c(2)
							
			graph set window fontface "Times"
			coefplot (matrix(ITT_exp_end_coef_CI[1,]), ci((ITT_exp_end_coef_CI[2,] ITT_exp_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
				(matrix(ITT_imp_end_coef_CI[1,]), ci((ITT_imp_end_coef_CI[2,] ITT_imp_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)) ///
				(matrix(ITT_beh_end_coef_CI[1,]), ci((ITT_beh_end_coef_CI[2,] ITT_beh_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(shortdash)) mcolor(black) msymbol(circle)), ///
					name(endline, replace) scheme(plotplain) ///
					xtitle("Covariate-adjusted treatment effect", margin(medsmall)) xlabel(-2(.5).5, nogrid) ///
					ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
					legend(on position(6) cols(2) label(1 2 "Explicit" 4 "Implicit" 6 "Behavioral")) ///
					xline(0, lcolor(black) lpattern(dash)) ///
					title("Endline")
					
					
			grc1leg midline endline ,  ycommon scheme(plotplain) col(2)  name(affpol_covars_margins, replace) ///
				title("")
			graph display affpol_covars_margins, xsize(10) ysize(5)	
			graph export "figures/affpol_covars_margins.pdf", as(pdf) replace
			

* Figure O.1: Treatment effects on affective polarization and support for depolarization, adjusting for baseline values of the outcome

	eststo affpol_lag_mid: reg idx_affect_pol_noneg_comf treatment i.block b_affpol_noneg_comf if wave==2
	eststo affpol_lag_end: reg idx_affect_pol_noneg_comf treatment i.block b_affpol_noneg_comf if wave==3
	eststo iat_lag_mid: reg dinparty treatment i.block b_iat if wave==2
	eststo iat_lag_end: reg dinparty treatment i.block b_iat if wave==3
	
	

			est restore affpol_lag_mid
			margins, dydx(treatment)
				matrix ITT_exp_mid = r(table)
					matselrc ITT_exp_mid ITT_exp_mid_coef_CI, r(1, 5, 6) c(1)
			est restore iat_lag_mid
			margins, dydx(treatment)
				matrix ITT_imp_mid = r(table)
					matselrc ITT_imp_mid ITT_imp_mid_coef_CI, r(1, 5, 6) c(1)
				
			graph set window fontface "Times"
			coefplot (matrix(ITT_exp_mid_coef_CI[1,]), ci((ITT_exp_mid_coef_CI[2,] ITT_exp_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
				(matrix(ITT_imp_mid_coef_CI[1,]), ci((ITT_imp_mid_coef_CI[2,] ITT_imp_mid_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)), ///
					name(midline, replace) scheme(plotplain) ///
					xtitle("Treatment effect controlling for baseline outcome values", margin(medsmall)) xlabel(-.5(.25).5, nogrid) ///
					ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
					legend(on nostack position(6) cols(3)order(2 "Explicit" 4 "Implicit")) ///
					xline(0, lcolor(black) lpattern(dash)) ///
					title("Midline")
					
					
			est restore affpol_lag_end
			margins, dydx(treatment)
				matrix ITT_exp_end = r(table)
					matselrc ITT_exp_end ITT_exp_end_coef_CI, r(1, 5, 6) c(1)
			est restore iat_lag_end
			margins, dydx(treatment) 
				matrix ITT_imp_end = r(table)
					matselrc ITT_imp_end ITT_imp_end_coef_CI, r(1, 5, 6) c(1)
							
			graph set window fontface "Times"
			coefplot (matrix(ITT_exp_end_coef_CI[1,]), ci((ITT_exp_end_coef_CI[2,] ITT_exp_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(solid)) mcolor(black) msymbol(square)) ///
				(matrix(ITT_imp_end_coef_CI[1,]), ci((ITT_imp_end_coef_CI[2,] ITT_imp_end_coef_CI[3,])) recast(scatter) ciopts(lcolor(black) lpattern(longdash)) mcolor(black) msymbol(triangle)), ///
					name(endline, replace) scheme(plotplain) ///
					xtitle("Treatment effect controlling for baseline outcome values", margin(medsmall)) xlabel(-.5(.25).5, nogrid) ///
					ytitle("", margin(medsmall)) ylabel(, nogrid notick nolabels) ///
					legend(on position(6) cols(2) label(2 "Explicit" 4 "Implicit")) ///
					xline(0, lcolor(black) lpattern(dash)) ///
					title("Endline")
					
					
			grc1leg midline endline ,  ycommon scheme(plotplain) col(2)  name(affpol_lag_margins, replace) ///
				title("")
			graph display affpol_lag_margins, xsize(10) ysize(5)	
			graph export "figures/affpol_lag_margins.pdf", as(pdf) replace	
			

* Figure P.1: Effects on anti-democratic behavior on inparty candidate support by workshop participation
	
	eststo fam1_midline: reg canexp_pref_inparty i.treatment##i.canexp_treat_midline i.block if wave==2
	eststo fam1_endline: reg canexp_pref_inparty i.treatment##i.canexp_treat_endline i.block if wave==3

			est restore fam1_midline
			margins, dydx(canexp_treat_midline) by(treatment)
			marginsplot, name(fam1_midline, replace) title ("Midline", color(black) size(msmall)) scheme(plotplainblind) ///
				 ytitle("Marginal Effect of Norm Violation" "on Candidate Support") xtitle("Workshop Participation") legend(pos(6) ring(0)) xscale(range(-0.25 1.25)) xlabel(, nogrid) ///
				 plotopts(msymbol(O) mcolor(black) lcolor(black) ) ci1opts(lcolor(black) msiz(0))   ///
				graphregion(fcolor(white) ilcolor(white) lcolor(white))  ///
				yline(0) recast(scatter)
				
			est restore fam1_endline
			margins, dydx(canexp_treat_endline) by(treatment)
			marginsplot, name(fam1_endline, replace) title ("Endline", color(black) size(msmall)) scheme(plotplainblind) ///
				 ytitle("Marginal Effect of Norm Violation" "on Candidate Support") xtitle("Workshop Participation") legend(pos(6) ring(0)) xscale(range(-0.25 1.25)) xlabel(, nogrid) ///
				 plotopts(msymbol(O) mcolor(black) lcolor(black) ) ci1opts(lcolor(black) msiz(0))   ///
				graphregion(fcolor(white) ilcolor(white) lcolor(white))  ///
				yline(0) recast(scatter)

			graph combine fam1_midline fam1_endline , xcommon ycommon scheme(plotplain) col(3)  ///
				name(fam1, replace) 
			graph display fam1, xsize(8) ysize(4)
			graph export "figures/so_fam1.pdf", as(pdf) replace
			
			
* Figure P.2: Treatment effects on support for civil discourse
	
	eststo fam2: reg civil_support i.treatment##i.wave i.block, cluster(uid)	

			est restore fam2
			margins, dydx(treatment) by(wave)
			marginsplot , name(fam2, replace) scheme(plotplain) yline(0, lcolor(red)) /// 
				title("Support for Civil Discourse") ytitle("Marginal Effect of Treatment") xtitle("") ///
				plotopts(msymbol(O) mcolor(black) lcolor(black) ) ci1opts(lcolor(black) msiz(0)) xsize(4) ysize(4)	
			graph display fam2, xsize(4) ysize(4)
			graph export "figures/so_fam2.pdf", as(pdf) replace	
				
			
* Figure P.3: Treatment effects on self-reported capacity for civil discourse

	eststo fam3: reg civil_capacity i.treatment##i.wave i.block, cluster(uid)

			est restore fam3
			margins, dydx(treatment) by(wave)
			marginsplot , name(fam3, replace) scheme(plotplain) yline(0, lcolor(red)) /// 
				title("Capacity for Civil Discourse") ytitle("Marginal Effect of Treatment") xtitle("") ///
				plotopts(msymbol(O) mcolor(black) lcolor(black) ) ci1opts(lcolor(black) msiz(0)) xsize(4) ysize(4)	
			graph display fam3, xsize(4) ysize(4)
			graph export "figures/so_fam3.pdf", as(pdf) replace	
			

* Figure P.4: Treatment effects on support for pro-democratic politicians and actions

	graph drop _all

	foreach dv in covid_protest_r  blm_oppose_r  greendeal_gen_r  elect_delay_r  daca_heart_r healthcare_liberty_d  mailin_threat_d  police_anarch_d  covid_lockdown_d  gunban_cons_d {
	eststo `dv': reg `dv' treatment i.block if wave==3 
	eststo `dv'_d: reg `dv' treatment i.block if party=="Blue" & wave==3 
	eststo `dv'_r: reg `dv' treatment i.block if party=="Red" & wave==3 
	}

			coefplot (covid_protest_r, label(Anti-Lockdown (R))) ///
			(blm_oppose_r, label(Anti-BLM (R))) ///
			(greendeal_gen_r, label(Anti-Green New Deal (R))) ///
			(elect_delay_r, label(Pro-Election Delay (R))) ///
			(daca_heart_r, label(Anti-DACA (R))) ///
			(healthcare_liberty_d, label(Pro-Universal Health Care (D))) ///
			(mailin_threat_d, label(Pro-Mail In Ballots (D))) ///
			(police_anarch_d, label(Anti-Police (D))) ///
			(covid_lockdown_d, label(Pro-Lockdown (D))) ///
			(gunban_cons_d, label(Anti-Gun (D))) ///
			, keep(treatment) xline(0, lcolor(red))   scheme(plotplain) xtitle("Marginal Effect of Treatment""on Ad Hominem Attributions") ///
			nolabels noeqlabels swapnames ///
			title(Full Sample) name(fam4full)



				* democratic
			coefplot (covid_protest_r_d, label(Anti-Lockdown (R))) ///
			(blm_oppose_r_d, label(Anti-BLM (R))) ///
			(greendeal_gen_r_d, label(Anti-Green New Deal (R))) ///
			(elect_delay_r_d, label(Pro-Election Delay (R))) ///
			(daca_heart_r_d, label(Anti-DACA (R))) ///
			(healthcare_liberty_d_d, label(Pro-Universal Health Care (D))) ///
			(mailin_threat_d_d, label(Pro-Mail In Ballots (D))) ///
			(police_anarch_d_d, label(Anti-Police (D))) ///
			(covid_lockdown_d_d, label(Pro-Lockdown (D))) ///
			(gunban_cons_d_d, label(Anti-Gun (D))) ///
			, keep(treatment) xline(0, lcolor(red))   scheme(plotplain) xtitle("Marginal Effect of Treatment""on Ad Hominem Attributions") ///
			nolabels noeqlabels swapnames ///
			title(Democratic Respondents) name(fam4dem)


				* republican
			coefplot (covid_protest_r_r, label(Anti-Lockdown (R))) ///
			(blm_oppose_r_r, label(Anti-BLM (R))) ///
			(greendeal_gen_r_r, label(Anti-Green New Deal (R))) ///
			(elect_delay_r_r, label(Pro-Election Delay (R))) ///
			(daca_heart_r_r, label(Anti-DACA (R))) ///
			(healthcare_liberty_d_r, label(Pro-Universal Health Care (D))) ///
			(mailin_threat_d_r, label(Pro-Mail In Ballots (D))) ///
			(police_anarch_d_r, label(Anti-Police (D))) ///
			(covid_lockdown_d_r, label(Pro-Lockdown (D))) ///
			(gunban_cons_d_r, label(Anti-Gun (D))) ///
			, keep(treatment) xline(0, lcolor(red))   scheme(plotplain) xtitle("Marginal Effect of Treatment""on Ad Hominem Attributions") ///
			nolabels noeqlabels swapnames ///
			title(Republican Respondents) name(fam4rep)


			graph combine fam4full fam4dem fam4rep , xcommon ycommon scheme(plotplain) col(1)  ///
				name(fam4, replace) 
			graph display fam4, xsize(4) ysize(9)
			graph export "figures/so_fam4.pdf", as(pdf) replace
			
			
* Figure Q.1: Pretreatment predictors of midline attrition by treatment status


	* by treatment: midline
eststo att_treat: reg attrit_mid treatment   i.block if uidtag==1

	* by affective polarization: midline
foreach dv in affpol_noneg_comf iat {
eststo att_`dv'_f: reg attrit_mid treatment b_`dv'  i.block if uidtag==1
eststo att_`dv'_c: reg attrit_mid  b_`dv'  i.block if uidtag==1 & treatment==0
eststo att_`dv'_t: reg attrit_mid  b_`dv'  i.block if uidtag==1 & treatment==1
}


	* by affective polarization components: midline
foreach dv in therm_diff_std trust_diff_std outparty_against_std outparty_friends_std outparty_neigh_std outparty_marry_std outparty_threat_std {
eststo att_`dv'_f: reg attrit_mid treatment b_`dv'  i.block if uidtag==1
eststo att_`dv'_c: reg attrit_mid treatment b_`dv'  i.block if uidtag==1 & treatment==0
eststo att_`dv'_t: reg attrit_mid treatment b_`dv'  i.block if uidtag==1 & treatment==1
}


	* by mediators: midline
foreach dv in m1a m2a m2b m3 m4 m5 m6 m7  {
eststo att_`dv'_f: reg attrit_mid treatment b_`dv'  i.block if uidtag==1
eststo att_`dv'_c: reg attrit_mid  b_`dv'  i.block if uidtag==1 & treatment==0
eststo att_`dv'_t: reg attrit_mid  b_`dv'  i.block if uidtag==1 & treatment==1
}


	* by moderators: midline 
foreach dv in ideoextreme idx_pol_engage idx_outparty_contact idx_empathy  {
eststo att_`dv'_f: reg attrit_mid treatment b_`dv'  i.block if uidtag==1
eststo att_`dv'_c: reg attrit_mid  b_`dv'  i.block if uidtag==1 & treatment==0
eststo att_`dv'_t: reg attrit_mid  b_`dv'  i.block if uidtag==1 & treatment==1
}

	* by treatment: endline

eststo att_treate: reg attrit_end treatment   i.block if uidtag==1

	* by affective polarization: endline
foreach dv in affpol_noneg_comf iat {
eststo att_`dv'_fe: reg attrit_end treatment b_`dv'  i.block if uidtag==1
eststo att_`dv'_ce: reg attrit_end  b_`dv'  i.block if uidtag==1 & treatment==0
eststo att_`dv'_te: reg attrit_end  b_`dv'  i.block if uidtag==1 & treatment==1
}


	* by affective polarization components: endline
foreach dv in therm_diff_std trust_diff_std outparty_against_std outparty_friends_std outparty_neigh_std outparty_marry_std outparty_threat_std {
eststo att_`dv'_fe: reg attrit_end treatment b_`dv'  i.block if uidtag==1
eststo att_`dv'_ce: reg attrit_end treatment b_`dv'  i.block if uidtag==1 & treatment==0
eststo att_`dv'_te: reg attrit_end treatment b_`dv'  i.block if uidtag==1 & treatment==1
}


	* by mediators: endline
foreach dv in m1a m2a m2b m3 m4 m5 m6 m7  {
eststo att_`dv'_fe: reg attrit_end treatment b_`dv'  i.block if uidtag==1
eststo att_`dv'_ce: reg attrit_end  b_`dv'  i.block if uidtag==1 & treatment==0
eststo att_`dv'_te: reg attrit_end  b_`dv'  i.block if uidtag==1 & treatment==1
}


	* by moderators: endline 
foreach dv in ideoextreme idx_pol_engage idx_outparty_contact idx_empathy  {
eststo att_`dv'_fe: reg attrit_end treatment b_`dv'  i.block if uidtag==1
eststo att_`dv'_ce: reg attrit_end  b_`dv'  i.block if uidtag==1 & treatment==0
eststo att_`dv'_te: reg attrit_end  b_`dv'  i.block if uidtag==1 & treatment==1
}
	* midline


			foreach dv in affpol_noneg_comf iat therm_diff_std outparty_against_std trust_diff_std outparty_friends_std outparty_neigh_std outparty_marry_std outparty_threat_std m1a m2a m2b m3 m4 m5 m6 m7 ideoextreme idx_pol_engage idx_outparty_contact idx_empathy {
			coefplot ///
			(att_`dv'_f, label(Full Sample)) ///
			(att_`dv'_c, label(Control)) ///
			(att_`dv'_t, label(Treatment)) , drop(treatment _cons *.block) ///
				xline(0, lcolor(red))   scheme(plotplain) ///
				nolabels noeqlabels swapnames ///
				title(`: variable label b_`dv'') name(`dv', replace)
			}

			grc1leg affpol_noneg_comf iat therm_diff_std outparty_against_std trust_diff_std outparty_friends_std outparty_neigh_std outparty_marry_std outparty_threat_std m1a m2a m2b m3 m4 m5 m6 m7 ideoextreme idx_pol_engage idx_outparty_contact idx_empathy ,  xcommon scheme(plotplain) col(3)  name(attrition, replace) ///
				pos(5) title("Marginal Effect on Midline Attrition")
			graph display attrition, xsize(8) ysize(10)
			graph export "figures/attrition_midline_bytr.pdf", as(pdf) replace



* Figure Q.2: Pretreatment predictors of endline attrition by treatment status


	* endline
			foreach dv in affpol_noneg_comf iat therm_diff_std outparty_against_std trust_diff_std outparty_friends_std outparty_neigh_std outparty_marry_std outparty_threat_std m1a m2a m2b m3 m4 m5 m6 m7 ideoextreme idx_pol_engage idx_outparty_contact idx_empathy {
			coefplot ///
			(att_`dv'_fe, label(Full Sample)) ///
			(att_`dv'_ce, label(Control)) ///
			(att_`dv'_te, label(Treatment)) , drop(treatment _cons *.block) ///
				xline(0, lcolor(red))   scheme(plotplain) ///
				nolabels noeqlabels swapnames ///
				title(`: variable label b_`dv'') name(`dv', replace)
			}

			grc1leg affpol_noneg_comf iat therm_diff_std outparty_against_std trust_diff_std outparty_friends_std outparty_neigh_std outparty_marry_std outparty_threat_std m1a m2a m2b m3 m4 m5 m6 m7 ideoextreme idx_pol_engage idx_outparty_contact idx_empathy ,  xcommon scheme(plotplain) col(3)  name(attrition, replace) ///
				pos(5) title("Marginal Effect on Endline Attrition")
			graph display attrition, xsize(8) ysize(10)
			graph export "figures/attrition_endline_bytr.pdf", as(pdf) replace
			
			
* Table Q.1: Generated using R: execute TabQ1.R.


* Table R.1: Treatment effects on affective polarization and support for depolarization

	* DiD, table format
				
		est restore affpol_wave
						
		est restore iat_wave

		est restore donate_wave

		esttab affpol_wave iat_wave donate_wave using "tables/main_wave.tex", replace ///			
			label booktabs b(3) se(3) eqlabels(none) br ///
			keep(1.treatment 2.wave 3.wave 1.treatment#2.wave 1.treatment#3.wave) ///
			mtitle("Explicit" "Implicit" "Behavioral") ///
			star(* 0.10 ** 0.05 *** 0.01) nonotes ///
			coeflabel(1.treatment "Treatment" 2.wave "Midline" 3.wave "Endline" 1.treatment#2.wave "Treatment $\times$ midline" 1.treatment#3.wave "Treatment $\times$ endline")

* Table R.2: Marginal effects on affective polarization and support for depolarization


		est restore affpol_wave
			margins, dydx(treatment) by(wave) post
				eststo affpol_wave_margins
						
		est restore iat_wave
			margins, dydx(treatment) by(wave) post
				eststo iat_wave_margins

		est restore donate_wave
			margins, dydx(treatment) by(wave) post
				eststo donate_wave_margins

		esttab affpol_wave_margins iat_wave_margins donate_wave_margins using "tables/main_mewave.tex", replace ///			
			label booktabs b(3) se(3) eqlabels(none) br ///
			mtitle("Explicit" "Implicit" "Behavioral") ///
			keep(1.treatment:2.wave 1.treatment:3.wave) ///
			star(* 0.10 ** 0.05 *** 0.01) nonotes ///
			coeflabel(2.wave "Midline" 3.wave "Endline")
	
* Table R.3: Treatment effects on affective polarization and support for depolarization, in-party vs. out-party


		est restore inparty_therm_wave
						
		est restore outparty_therm_wave

		est restore inparty_trust_wave

		est restore outparty_trust_wave
		
		esttab inparty_therm_wave outparty_therm_wave inparty_trust_wave outparty_trust_wave using "tables/inparty_outparty_pwave.tex", replace ///			
			label booktabs b(3) se(3) eqlabels(none) br ///
			keep(1.treatment 2.wave 3.wave 1.treatment#2.wave 1.treatment#3.wave) ///
			mtitle("\shortstack{Inparty \\ trust}" "\shortstack{Outparty \\ trust}" "\shortstack{Inparty \\ thermometer}" "\shortstack{Outparty \\ thermometer}") ///
			star(* 0.10 ** 0.05 *** 0.01) nonotes ///
			coeflabel(1.treatment "Treatment" 2.wave "Midline" 3.wave "Endline" 1.treatment#2.wave "Treatment $\times$ midline" 1.treatment#3.wave "Treatment $\times$ endline")
			
* Table R.4: Treatment effects on affective polarization and support for depolarization by party

		
		est restore inparty_therm_wave
			margins, dydx(treatment) by(wave) post
			eststo inparty_therm_wave_margins
				
		est restore outparty_therm_wave
			margins, dydx(treatment) by(wave) post
				eststo outparty_therm_wave_margins

		est restore inparty_trust_wave
			margins, dydx(treatment) by(wave) post
				eststo inparty_trust_wave_margins

		est restore outparty_trust_wave
			margins, dydx(treatment) by(wave) post
				eststo outparty_trust_wave_margins

		esttab inparty_therm_wave_margins outparty_therm_wave_margins inparty_trust_wave_margins outparty_trust_wave_margins using "tables/inparty_outparty_pwave_margins.tex", replace ///				
			label booktabs b(3) se(3) eqlabels(none) br ///
			mtitle("\shortstack{Inparty \\ trust}" "\shortstack{Outparty \\ trust}" "\shortstack{Inparty \\ thermometer}" "\shortstack{Outparty \\ thermometer}") ///
			keep(1.treatment:2.wave 1.treatment:3.wave) ///
			star(* 0.10 ** 0.05 *** 0.01) nonotes ///
			coeflabel(2.wave "Midline" 3.wave "Endline")
	
	
* Table R.5: Treatment effects on affective polarization and support for depolarization by party

	eststo party1_did: reg affpol_noneg_comf i.treatment##i.wave##i.party3 i.block  , cluster(uid)
			
	eststo party2_did: reg iat i.treatment##i.wave##i.party3 i.block  , cluster(uid)
						
	eststo party3_did: reg donate i.treatment##i.wave##i.party3 i.block  , cluster(uid)

			est restore party1_did
	
			est restore party2_did

			est restore party3_did			

			esttab party1_did party2_did party3_did using "tables/hte1_party_pwave.tex", replace ///			
				label booktabs b(3) se(3) eqlabels(none) br ///
				keep(1.treatment 2.wave 3.wave 2.party3 3.party3 1.treatment#2.wave 1.treatment#3.wave 1.treatment#2.party3 1.treatment#3.party3 ///
				2.wave#2.party3 2.wave#3.party3 3.wave#2.party3 3.wave#3.party3 ///
				1.treatment#2.wave#2.party3 1.treatment#2.wave#3.party3 1.treatment#3.wave#2.party3 1.treatment#3.wave#3.party3) ///
				mtitle("Explicit" "Implicit" "Behavioral") ///
				star(* 0.10 ** 0.05 *** 0.01) nonotes ///
				coeflabel(1.treatment "Treatment" 2.wave "Midline" 3.wave "Endline" 2.party3 "Republicans" 3.party3 "Independents" ///
					1.treatment#2.wave "Treatment $\times$ midline" 1.treatment#3.wave "Treatment $\times$ endline" ///
					1.treatment#2.party3 "Treatment $\times$ Republicans" 1.treatment#3.party3 "Treatment $\times$ Independents" ///
					2.wave#2.party3 "Midline $\times$ Republicans" 2.wave#3.party3 "Midline $\times$ Independents" ///
					3.wave#2.party3 "Endline $\times$ Republicans" 3.wave#3.party3 "Endline $\times$ Independents" ///
					1.treatment#2.wave#2.party3 "Treatment $\times$ midline $\times$ Republicans" 1.treatment#2.wave#3.party3 "Treatment $\times$ midline $\times$ Independents" ///
					1.treatment#3.wave#2.party3 "Treatment $\times$ endline $\times$ Republicans" 1.treatment#3.wave#3.party3 "Treatment $\times$ endline $\times$ Independents" )
